package interface_;

/**
 * @description:
 * @Author yyp
 * @time
 */
public class Interface01 {
    public static void main(String[] args) {
        //创建手机对象
        Phone phone = new Phone();
        Computer computer = new Computer();
        computer.work(phone);
    }
}

interface UsbInterface{
    //定义接口，认为定义
    public void start();
    public void stop();
}
class Phone implements UsbInterface{//实现接口，必须按照定义的接口来做
    public void start() {
        System.out.println("手机开始工作");
    }
    public void stop() {
        System.out.println("手机结束工作");
    }
}
class Computer{
    public void work(UsbInterface usbInterface){
        //通过接口来调用
        usbInterface.start();
        usbInterface.stop();
    }
}
